**********************************************************************
*TABLE A8: Defensive ownership and exporter status, 2004
*********************************************************************
local mresult "Results/TableA8.xls"
local rresult "Results/TableA8r.xls"

use "Regressions Data/baseline0406.dta",clear
merge m:1 okpo using "Prepared data/export2004.dta" 
replace exp04=0 if exp04==.
replace exp04=0 if exp04==.
drop _merge

set more off
keep if year==2004

*No oligarch in chain
reg no_oligarch_chain  orange gray lemp tfp privatized exp04 sec1 sec2 sec4-sec10, cluster(group)
outreg2 using `mresult',  replace dec(3) ctitle(OLS oligarch) keep(orange gray lemp tfp privatized exp04)

ivreg2 no_oligarch_chain (orange=YuDec) gray lemp tfp privatized exp04 sec1 sec2 sec4-sec10,first cluster(group)
outreg2 using `mresult',  append dec(3)  ctitle(IV oligarch) keep(orange gray lemp tfp privatized exp04)

*Distance to oligarch
reg mdistance  orange gray lemp tfp privatized exp04 sec1 sec2 sec4-sec10, cluster(group)
outreg2 using `mresult',  append dec(3)  ctitle(OLS distance) keep(orange gray lemp tfp privatized exp04)

ivreg2 mdistance (orange=YuDec) gray lemp tfp privatized exp04 sec1 sec2 sec4-sec10, first cluster(group)
outreg2 using `mresult',  append dec(3)  ctitle(IV distance) keep(orange gray lemp tfp privatized exp04)

*Reduced form
reg no_oligarch_chain  YuDec gray lemp tfp privatized exp04 sec1 sec2 sec4-sec10, cluster(group)
outreg2 using `rresult',  replace dec(3) ctitle(No oligarch) keep(YuDec)

reg mdistance YuDec gray lemp tfp privatized exp04 sec1 sec2 sec4-sec10, cluster(group)
outreg2 using `rresult',  append dec(3) ctitle(Distance) keep(YuDec)


*FOREIGN AND OFFSHORE
use "Regressions Data/baseline0406_nown.dta",clear
merge m:1 okpo using "Prepared data/export2004.dta"  
replace exp04=0 if exp04==.
replace exp04=0 if exp04==.
drop _merge
set more off
keep if year==2004

*Foreign
reg foreign_in_chain  orange gray lemp tfp privatized exp04 sec1 sec2 sec4-sec10, cluster(group)
outreg2 using `mresult',  append dec(3) ctitle(OLS foreign) keep(orange gray  lemp tfp privatized exp04)

ivreg2 foreign_in_chain (orange=YuDec) gray lemp tfp privatized exp04 sec1 sec2 sec4-sec10, first cluster(group)
outreg2 using `mresult',  append dec(3) ctitle(IV foreign) keep(orange gray lemp tfp privatized exp04)

*Offshore
reg offshore  orange gray lemp tfp privatized exp04 sec1 sec2 sec4-sec10,cluster(group) 
outreg2 using `mresult',  append dec(3) ctitle(OLS offshore) keep(orange gray lemp tfp privatized exp04)

ivreg2 offshore (orange=YuDec) gray lemp tfp privatized exp04 sec1 sec2 sec4-sec10,cluster(group) first
outreg2 using `mresult',  append dec(3) ctitle(IV offshore) keep(orange gray lemp tfp privatized exp04)

*Reduced form
reg foreign_in_chain   YuDec gray lemp tfp privatized exp04 sec1 sec2 sec4-sec10, cluster(group)
outreg2 using `rresult',  append dec(3) ctitle(foreign_in_chain) keep(YuDec)

reg offshore YuDec gray lemp tfp privatized exp04 sec1 sec2 sec4-sec10, cluster(group)
outreg2 using `rresult',  append dec(3) ctitle(Offshore) keep(YuDec)

*Summary table on export status by color
use "Regressions Data/baseline0406.dta",clear
merge m:1 okpo using "Prepared data/export2004.dta"  
replace exp04=0 if exp04==.
replace exp04=0 if exp04==.
drop _merge
keep if year==2004

*tabultation of export status by color
tab exp04 color

